<?php
	/**
	 * This is a MetaControl class, providing a QForm or QPanel access to event handlers
	 * and QControls to perform the Create, Edit, and Delete functionality
	 * of the MantisFiltersTable class.  This code-generated class
	 * contains all the basic elements to help a QPanel or QForm display an HTML form that can
	 * manipulate a single MantisFiltersTable object.
	 *
	 * To take advantage of some (or all) of these control objects, you
	 * must create a new QForm or QPanel which instantiates a MantisFiltersTableMetaControl
	 * class.
	 *
	 * Any and all changes to this file will be overwritten with any subsequent
	 * code re-generation.
	 *
	 * @package My QCubed Application
	 * @subpackage MetaControls
	 * @property-read MantisFiltersTable $MantisFiltersTable the actual MantisFiltersTable data class being edited
	 * @property QLabel $IdControl
	 * @property-read QLabel $IdLabel
	 * @property QIntegerTextBox $UserIdControl
	 * @property-read QLabel $UserIdLabel
	 * @property QIntegerTextBox $ProjectIdControl
	 * @property-read QLabel $ProjectIdLabel
	 * @property QIntegerTextBox $IsPublicControl
	 * @property-read QLabel $IsPublicLabel
	 * @property QTextBox $NameControl
	 * @property-read QLabel $NameLabel
	 * @property QTextBox $FilterStringControl
	 * @property-read QLabel $FilterStringLabel
	 * @property-read string $TitleVerb a verb indicating whether or not this is being edited or created
	 * @property-read boolean $EditMode a boolean indicating whether or not this is being edited or created
	 */

	class MantisFiltersTableMetaControlGen extends QBaseClass {
		// General Variables
		/**
		 * @var MantisFiltersTable objMantisFiltersTable
		 * @access protected
		 */
		protected $objMantisFiltersTable;
		/**
		 * @var QForm|QControl objParentObject
		 * @access protected
		 */
		protected $objParentObject;
		/**
		 * @var string strTitleVerb
		 * @access protected
		 */
		protected $strTitleVerb;
		/**
		 * @var boolean blnEditMode
		 * @access protected
		 */
		protected $blnEditMode;

		// Controls that allow the editing of MantisFiltersTable's individual data fields
		/**
		 * @var QLabel lblId
		 * @access protected
		 */
		protected $lblId;
		/**
		 * @var QIntegerTextBox txtUserId
		 * @access protected
		 */
		protected $txtUserId;
		/**
		 * @var QIntegerTextBox txtProjectId
		 * @access protected
		 */
		protected $txtProjectId;
		/**
		 * @var QIntegerTextBox txtIsPublic
		 * @access protected
		 */
		protected $txtIsPublic;
		/**
		 * @var QTextBox txtName
		 * @access protected
		 */
		protected $txtName;
		/**
		 * @var QTextBox txtFilterString
		 * @access protected
		 */
		protected $txtFilterString;

		// Controls that allow the viewing of MantisFiltersTable's individual data fields
		/**
		 * @var QLabel lblUserId
		 * @access protected
		 */
		protected $lblUserId;
		/**
		 * @var QLabel lblProjectId
		 * @access protected
		 */
		protected $lblProjectId;
		/**
		 * @var QLabel lblIsPublic
		 * @access protected
		 */
		protected $lblIsPublic;
		/**
		 * @var QLabel lblName
		 * @access protected
		 */
		protected $lblName;
		/**
		 * @var QLabel lblFilterString
		 * @access protected
		 */
		protected $lblFilterString;

		// QListBox Controls (if applicable) to edit Unique ReverseReferences and ManyToMany References

		// QLabel Controls (if applicable) to view Unique ReverseReferences and ManyToMany References


		/**
		 * Main constructor.  Constructor OR static create methods are designed to be called in either
		 * a parent QPanel or the main QForm when wanting to create a
		 * MantisFiltersTableMetaControl to edit a single MantisFiltersTable object within the
		 * QPanel or QForm.
		 *
		 * This constructor takes in a single MantisFiltersTable object, while any of the static
		 * create methods below can be used to construct based off of individual PK ID(s).
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this MantisFiltersTableMetaControl
		 * @param MantisFiltersTable $objMantisFiltersTable new or existing MantisFiltersTable object
		 */
		 public function __construct($objParentObject, MantisFiltersTable $objMantisFiltersTable) {
			// Setup Parent Object (e.g. QForm or QPanel which will be using this MantisFiltersTableMetaControl)
			$this->objParentObject = $objParentObject;

			// Setup linked MantisFiltersTable object
			$this->objMantisFiltersTable = $objMantisFiltersTable;

			// Figure out if we're Editing or Creating New
			if ($this->objMantisFiltersTable->__Restored) {
				$this->strTitleVerb = QApplication::Translate('Edit');
				$this->blnEditMode = true;
			} else {
				$this->strTitleVerb = QApplication::Translate('Create');
				$this->blnEditMode = false;
			}
		 }

		/**
		 * Static Helper Method to Create using PK arguments
		 * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
		 * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
		 * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to
		 * edit, or if we are also allowed to create a new one, etc.
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this MantisFiltersTableMetaControl
		 * @param integer $intId primary key value
		 * @param QMetaControlCreateType $intCreateType rules governing MantisFiltersTable object creation - defaults to CreateOrEdit
 		 * @return MantisFiltersTableMetaControl
		 */
		public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			// Attempt to Load from PK Arguments
			if (strlen($intId)) {
				$objMantisFiltersTable = MantisFiltersTable::Load($intId);

				// MantisFiltersTable was found -- return it!
				if ($objMantisFiltersTable)
					return new MantisFiltersTableMetaControl($objParentObject, $objMantisFiltersTable);

				// If CreateOnRecordNotFound not specified, throw an exception
				else if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound)
					throw new QCallerException('Could not find a MantisFiltersTable object with PK arguments: ' . $intId);

			// If EditOnly is specified, throw an exception
			} else if ($intCreateType == QMetaControlCreateType::EditOnly)
				throw new QCallerException('No PK arguments specified');

			// If we are here, then we need to create a new record
			return new MantisFiltersTableMetaControl($objParentObject, new MantisFiltersTable());
		}

		/**
		 * Static Helper Method to Create using PathInfo arguments
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this MantisFiltersTableMetaControl
		 * @param QMetaControlCreateType $intCreateType rules governing MantisFiltersTable object creation - defaults to CreateOrEdit
		 * @return MantisFiltersTableMetaControl
		 */
		public static function CreateFromPathInfo($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			$intId = QApplication::PathInfo(0);
			return MantisFiltersTableMetaControl::Create($objParentObject, $intId, $intCreateType);
		}

		/**
		 * Static Helper Method to Create using QueryString arguments
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this MantisFiltersTableMetaControl
		 * @param QMetaControlCreateType $intCreateType rules governing MantisFiltersTable object creation - defaults to CreateOrEdit
		 * @return MantisFiltersTableMetaControl
		 */
		public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			$intId = QApplication::QueryString('intId');
			return MantisFiltersTableMetaControl::Create($objParentObject, $intId, $intCreateType);
		}



		///////////////////////////////////////////////
		// PUBLIC CREATE and REFRESH METHODS
		///////////////////////////////////////////////

		/**
		 * Create and setup QLabel lblId
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblId_Create($strControlId = null) {
			$this->lblId = new QLabel($this->objParentObject, $strControlId);
			$this->lblId->Name = QApplication::Translate('Id');
			if ($this->blnEditMode)
				$this->lblId->Text = $this->objMantisFiltersTable->Id;
			else
				$this->lblId->Text = 'N/A';
			return $this->lblId;
		}

		/**
		 * Create and setup QIntegerTextBox txtUserId
		 * @param string $strControlId optional ControlId to use
		 * @return QIntegerTextBox
		 */
		public function txtUserId_Create($strControlId = null) {
			$this->txtUserId = new QIntegerTextBox($this->objParentObject, $strControlId);
			$this->txtUserId->Name = QApplication::Translate('User Id');
			$this->txtUserId->Text = $this->objMantisFiltersTable->UserId;
			$this->txtUserId->Required = true;
			return $this->txtUserId;
		}

		/**
		 * Create and setup QLabel lblUserId
		 * @param string $strControlId optional ControlId to use
		 * @param string $strFormat optional sprintf format to use
		 * @return QLabel
		 */
		public function lblUserId_Create($strControlId = null, $strFormat = null) {
			$this->lblUserId = new QLabel($this->objParentObject, $strControlId);
			$this->lblUserId->Name = QApplication::Translate('User Id');
			$this->lblUserId->Text = $this->objMantisFiltersTable->UserId;
			$this->lblUserId->Required = true;
			$this->lblUserId->Format = $strFormat;
			return $this->lblUserId;
		}

		/**
		 * Create and setup QIntegerTextBox txtProjectId
		 * @param string $strControlId optional ControlId to use
		 * @return QIntegerTextBox
		 */
		public function txtProjectId_Create($strControlId = null) {
			$this->txtProjectId = new QIntegerTextBox($this->objParentObject, $strControlId);
			$this->txtProjectId->Name = QApplication::Translate('Project Id');
			$this->txtProjectId->Text = $this->objMantisFiltersTable->ProjectId;
			$this->txtProjectId->Required = true;
			return $this->txtProjectId;
		}

		/**
		 * Create and setup QLabel lblProjectId
		 * @param string $strControlId optional ControlId to use
		 * @param string $strFormat optional sprintf format to use
		 * @return QLabel
		 */
		public function lblProjectId_Create($strControlId = null, $strFormat = null) {
			$this->lblProjectId = new QLabel($this->objParentObject, $strControlId);
			$this->lblProjectId->Name = QApplication::Translate('Project Id');
			$this->lblProjectId->Text = $this->objMantisFiltersTable->ProjectId;
			$this->lblProjectId->Required = true;
			$this->lblProjectId->Format = $strFormat;
			return $this->lblProjectId;
		}

		/**
		 * Create and setup QIntegerTextBox txtIsPublic
		 * @param string $strControlId optional ControlId to use
		 * @return QIntegerTextBox
		 */
		public function txtIsPublic_Create($strControlId = null) {
			$this->txtIsPublic = new QIntegerTextBox($this->objParentObject, $strControlId);
			$this->txtIsPublic->Name = QApplication::Translate('Is Public');
			$this->txtIsPublic->Text = $this->objMantisFiltersTable->IsPublic;
			return $this->txtIsPublic;
		}

		/**
		 * Create and setup QLabel lblIsPublic
		 * @param string $strControlId optional ControlId to use
		 * @param string $strFormat optional sprintf format to use
		 * @return QLabel
		 */
		public function lblIsPublic_Create($strControlId = null, $strFormat = null) {
			$this->lblIsPublic = new QLabel($this->objParentObject, $strControlId);
			$this->lblIsPublic->Name = QApplication::Translate('Is Public');
			$this->lblIsPublic->Text = $this->objMantisFiltersTable->IsPublic;
			$this->lblIsPublic->Format = $strFormat;
			return $this->lblIsPublic;
		}

		/**
		 * Create and setup QTextBox txtName
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtName_Create($strControlId = null) {
			$this->txtName = new QTextBox($this->objParentObject, $strControlId);
			$this->txtName->Name = QApplication::Translate('Name');
			$this->txtName->Text = $this->objMantisFiltersTable->Name;
			$this->txtName->Required = true;
			$this->txtName->MaxLength = MantisFiltersTable::NameMaxLength;
			return $this->txtName;
		}

		/**
		 * Create and setup QLabel lblName
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblName_Create($strControlId = null) {
			$this->lblName = new QLabel($this->objParentObject, $strControlId);
			$this->lblName->Name = QApplication::Translate('Name');
			$this->lblName->Text = $this->objMantisFiltersTable->Name;
			$this->lblName->Required = true;
			return $this->lblName;
		}

		/**
		 * Create and setup QTextBox txtFilterString
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtFilterString_Create($strControlId = null) {
			$this->txtFilterString = new QTextBox($this->objParentObject, $strControlId);
			$this->txtFilterString->Name = QApplication::Translate('Filter String');
			$this->txtFilterString->Text = $this->objMantisFiltersTable->FilterString;
			$this->txtFilterString->Required = true;
			$this->txtFilterString->TextMode = QTextMode::MultiLine;
			return $this->txtFilterString;
		}

		/**
		 * Create and setup QLabel lblFilterString
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblFilterString_Create($strControlId = null) {
			$this->lblFilterString = new QLabel($this->objParentObject, $strControlId);
			$this->lblFilterString->Name = QApplication::Translate('Filter String');
			$this->lblFilterString->Text = $this->objMantisFiltersTable->FilterString;
			$this->lblFilterString->Required = true;
			return $this->lblFilterString;
		}



		/**
		 * Refresh this MetaControl with Data from the local MantisFiltersTable object.
		 * @param boolean $blnReload reload MantisFiltersTable from the database
		 * @return void
		 */
		public function Refresh($blnReload = false) {
			if ($blnReload)
				$this->objMantisFiltersTable->Reload();

			if ($this->lblId) if ($this->blnEditMode) $this->lblId->Text = $this->objMantisFiltersTable->Id;

			if ($this->txtUserId) $this->txtUserId->Text = $this->objMantisFiltersTable->UserId;
			if ($this->lblUserId) $this->lblUserId->Text = $this->objMantisFiltersTable->UserId;

			if ($this->txtProjectId) $this->txtProjectId->Text = $this->objMantisFiltersTable->ProjectId;
			if ($this->lblProjectId) $this->lblProjectId->Text = $this->objMantisFiltersTable->ProjectId;

			if ($this->txtIsPublic) $this->txtIsPublic->Text = $this->objMantisFiltersTable->IsPublic;
			if ($this->lblIsPublic) $this->lblIsPublic->Text = $this->objMantisFiltersTable->IsPublic;

			if ($this->txtName) $this->txtName->Text = $this->objMantisFiltersTable->Name;
			if ($this->lblName) $this->lblName->Text = $this->objMantisFiltersTable->Name;

			if ($this->txtFilterString) $this->txtFilterString->Text = $this->objMantisFiltersTable->FilterString;
			if ($this->lblFilterString) $this->lblFilterString->Text = $this->objMantisFiltersTable->FilterString;

		}



		///////////////////////////////////////////////
		// PROTECTED UPDATE METHODS for ManyToManyReferences (if any)
		///////////////////////////////////////////////





		///////////////////////////////////////////////
		// PUBLIC MANTISFILTERSTABLE OBJECT MANIPULATORS
		///////////////////////////////////////////////

		/**
		 * This will save this object's MantisFiltersTable instance,
		 * updating only the fields which have had a control created for it.
		 */
		public function SaveMantisFiltersTable() {
			try {
				// Update any fields for controls that have been created
				if ($this->txtUserId) $this->objMantisFiltersTable->UserId = $this->txtUserId->Text;
				if ($this->txtProjectId) $this->objMantisFiltersTable->ProjectId = $this->txtProjectId->Text;
				if ($this->txtIsPublic) $this->objMantisFiltersTable->IsPublic = $this->txtIsPublic->Text;
				if ($this->txtName) $this->objMantisFiltersTable->Name = $this->txtName->Text;
				if ($this->txtFilterString) $this->objMantisFiltersTable->FilterString = $this->txtFilterString->Text;

				// Update any UniqueReverseReferences (if any) for controls that have been created for it

				// Save the MantisFiltersTable object
				$this->objMantisFiltersTable->Save();

				// Finally, update any ManyToManyReferences (if any)
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * This will DELETE this object's MantisFiltersTable instance from the database.
		 * It will also unassociate itself from any ManyToManyReferences.
		 */
		public function DeleteMantisFiltersTable() {
			$this->objMantisFiltersTable->Delete();
		}



		///////////////////////////////////////////////
		// PUBLIC GETTERS and SETTERS
		///////////////////////////////////////////////

		/**
		 * Override method to perform a property "Get"
		 * This will get the value of $strName
		 *
		 * @param string $strName Name of the property to get
		 * @return mixed
		 */
		public function __get($strName) {
			switch ($strName) {
				// General MetaControlVariables
				case 'MantisFiltersTable': return $this->objMantisFiltersTable;
				case 'TitleVerb': return $this->strTitleVerb;
				case 'EditMode': return $this->blnEditMode;

				// Controls that point to MantisFiltersTable fields -- will be created dynamically if not yet created
				case 'IdControl':
					if (!$this->lblId) return $this->lblId_Create();
					return $this->lblId;
				case 'IdLabel':
					if (!$this->lblId) return $this->lblId_Create();
					return $this->lblId;
				case 'UserIdControl':
					if (!$this->txtUserId) return $this->txtUserId_Create();
					return $this->txtUserId;
				case 'UserIdLabel':
					if (!$this->lblUserId) return $this->lblUserId_Create();
					return $this->lblUserId;
				case 'ProjectIdControl':
					if (!$this->txtProjectId) return $this->txtProjectId_Create();
					return $this->txtProjectId;
				case 'ProjectIdLabel':
					if (!$this->lblProjectId) return $this->lblProjectId_Create();
					return $this->lblProjectId;
				case 'IsPublicControl':
					if (!$this->txtIsPublic) return $this->txtIsPublic_Create();
					return $this->txtIsPublic;
				case 'IsPublicLabel':
					if (!$this->lblIsPublic) return $this->lblIsPublic_Create();
					return $this->lblIsPublic;
				case 'NameControl':
					if (!$this->txtName) return $this->txtName_Create();
					return $this->txtName;
				case 'NameLabel':
					if (!$this->lblName) return $this->lblName_Create();
					return $this->lblName;
				case 'FilterStringControl':
					if (!$this->txtFilterString) return $this->txtFilterString_Create();
					return $this->txtFilterString;
				case 'FilterStringLabel':
					if (!$this->lblFilterString) return $this->lblFilterString_Create();
					return $this->lblFilterString;
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		/**
		 * Override method to perform a property "Set"
		 * This will set the property $strName to be $mixValue
		 *
		 * @param string $strName Name of the property to set
		 * @param string $mixValue New value of the property
		 * @return mixed
		 */
		public function __set($strName, $mixValue) {
			try {
				switch ($strName) {
					// Controls that point to MantisFiltersTable fields
					case 'IdControl':
						return ($this->lblId = QType::Cast($mixValue, 'QControl'));
					case 'UserIdControl':
						return ($this->txtUserId = QType::Cast($mixValue, 'QControl'));
					case 'ProjectIdControl':
						return ($this->txtProjectId = QType::Cast($mixValue, 'QControl'));
					case 'IsPublicControl':
						return ($this->txtIsPublic = QType::Cast($mixValue, 'QControl'));
					case 'NameControl':
						return ($this->txtName = QType::Cast($mixValue, 'QControl'));
					case 'FilterStringControl':
						return ($this->txtFilterString = QType::Cast($mixValue, 'QControl'));
					default:
						return parent::__set($strName, $mixValue);
				}
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}
	}
?>